Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(autoware_lanelet_map_validator): add dangling reference checker to non existing intersection_area #177

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

soblin
Copy link
Contributor

@soblin soblin commented Dec 18, 2024

Description

This PR aims to add checker if any intersection lanelets (namely with turn_direction tag) has valid VALUE as the intersection_area key. If there are no intersection_area with corresponding VALUE id, it is dangling reference.

How was this PR tested?

Added a test map "intersection_area_with_dangling_reference.osm" with:

  • valid reference to existing intersection_area 10803 (lanelet 59)
  • dangling reference to non existing intersection_area 777 (lanelet 53)

Notes for reviewers

None.

Effects on system behavior

None.

Copy link

github-actions bot commented Dec 18, 2024

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@soblin soblin force-pushed the feat/vm-03-08-dangling-reference-intersection-area branch from adae44c to 7e22a32 Compare December 18, 2024 04:34
…to non existing intersection_area

Signed-off-by: Mamoru Sobue <[email protected]>
@soblin soblin force-pushed the feat/vm-03-08-dangling-reference-intersection-area branch from 7e22a32 to 60ea165 Compare December 18, 2024 04:39
@soblin soblin marked this pull request as ready for review December 18, 2024 04:41
Copy link
Contributor

@TaikiYamada4 TaikiYamada4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the great work!
I wrote my opinions below so please check them out.

Aside those comments

  • Could you write a brief document to explain what this validator can do?
  • Could you add this to autoware_requirement_set.json like the following?
  {
    "id": "vm-03-01",
    "validators": [
      {
        "name": "mapping.intersection.intersection_area_dangling_reference"
      }
    ]
  },

lanelet::validation::Severity::Error, lanelet::validation::Primitive::Lanelet, lanelet.id(),
append_issue_code_prefix(
this->name(), 1,
"Lanelet of ID " + std::to_string(lanelet.id()) +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The primitive (lanelet) and its ID will be displayed automatically since they are already given in L83, so the message starting with "This lanelet" might be fine.

Comment on lines +51 to +53
if (lanelet.attributeOr("turn_direction", "none") == std::string("none")) {
return std::nullopt;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this part necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is not good for a non-intersection lane to have "intersection_area" entry cause it's meaningless. And current implementation ignores that anyway. But I think we should sanitize that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the order

  1. Collect all intersection_area polygons first
  2. Scan through lanelets and find defected lanelets using is_intersection_with_area.

will be much efficient that we don't need to collect intersection_with_area_lanelets, but what do you think?

Comment on lines +23 to +47
class TestIntersectionAreaDanglingReferenceError : public MapValidationTester
{
protected:
void SetUp() override
{
// prepare `map_` and `loading_errors_`
// this class uses erroneous map
load_target_map("intersection/intersection_area_with_dangling_reference.osm");
}

private:
};

class TestIntersectionAreaDanglingReferenceOK : public MapValidationTester
{
protected:
void SetUp() override
{
// prepare `map_` and `loading_errors_`
// this class uses valid map
load_target_map("intersection/basic_intersection_area.osm");
}

private:
};
Copy link
Contributor

@TaikiYamada4 TaikiYamada4 Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think only one class is enough so try loading the maps at the start of the test functions if there's no special reason.

You can write the validation subject on the second argument of TEST_F.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants